package com.feng.vo;

import com.feng.constant.StatusCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: 丰
 * @date: 2022/12/7 15:06
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class ResultFileVo {

    private String msg;
    private Integer code;
    private Integer count;
    private FileVo data;

    public static ResultFileVo success(FileVo data){
        return new ResultFileVo(StatusCodeEnum.SUCCESS.getMsg(), StatusCodeEnum.SUCCESS.getCode(), 0, data);
    }

    public static ResultFileVo failed() {
        return new ResultFileVo(StatusCodeEnum.FAILED.getMsg(), StatusCodeEnum.FAILED.getCode(), 0, null);
    }

    public static  ResultFileVo failed(FileVo data) {
        return new ResultFileVo(StatusCodeEnum.FAILED.getMsg(), StatusCodeEnum.FAILED.getCode(), 0, data);
    }


    public ResultFileVo message(String msg){
        this.setMsg(msg);
        return this;
    }

    public ResultFileVo code(Integer code){
        this.setCode(code);
        return this;
    }

    public ResultFileVo count(Integer count){
        this.count = count;
        return this;
    }
}
